﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        String filePath = Request.PhysicalApplicationPath + @"created\" + DateTime.Now.ToFileTime() + ".jpg";
        System.IO.Stream input = Request.InputStream;
        FileStream output = new FileStream(filePath, FileMode.CreateNew);

        byte[] bytes = new byte[1024];
        int numBytesToRead = (int)input.Length;
        while (numBytesToRead > 0)
        {
            int count = input.Read(bytes, 0, 1024);
            output.Write(bytes, 0, count);
            if (count == 0)
            {
                break;
            }
            numBytesToRead -= count;
        }

        output.Close();
        input.Close();
    }
}
